home *** CD-ROM | disk | FTP | other *** search
- property pFunction, pFolderName, ancestor
- global gDownloadTexts, gDownloadPhotos, gVoid
-
- on beginSprite me
- set name to the name of the member of sprite the spriteNum of me
- if name contains "download" then
- set pFunction to #InitDownLoad
- end if
- if name contains "box" then
- set pFunction to #box
- end if
- if name contains "message" then
- set pFunction to #message
- end if
- if name contains "okay" then
- set pFunction to #CompleteDownLoad
- end if
- if name contains "cancel" then
- set pFunction to #Cancel
- end if
- if name contains "blocker" then
- set pFunction to #blocker
- end if
- case pFunction of
- #InitDownLoad:
- set ancestor to new(script "Bitmap But 1", the spriteNum of me, 3, 0)
- #CompleteDownLoad, #Cancel, #blocker:
- set ancestor to new(script "Bitmap But 1", the spriteNum of me, 3, 0)
- hide(me)
- otherwise:
- set ancestor to gVoid
- hide(me)
- end case
- end
-
- on MouseUpAction me
- case pFunction of
- #InitDownLoad:
- InitDownLoad(me)
- #CompleteDownLoad:
- set userDeterminesDestination to 0
- CompleteDownLoad(userDeterminesDestination)
- #blocker:
- nothing()
- #Cancel:
- sendAllSprites(#ClearOutDownload)
- end case
- end
-
- on MouseDownAction me
- nothing()
- end
-
- on MouseEnterAction me
- nothing()
- end
-
- on MouseLeaveAction me
- nothing()
- end
-
- on hide me
- if the locH of sprite the spriteNum of me > -500 then
- set the locH of sprite the spriteNum of me to the locH of sprite the spriteNum of me - 1000
- end if
- end
-
- on show me
- if the locH of sprite the spriteNum of me < -500 then
- set the locH of sprite the spriteNum of me to the locH of sprite the spriteNum of me + 1000
- end if
- end
-
- on InitDownLoad me
- if not (listp(gDownloadPhotos) and listp(gDownloadTexts)) then
- exit
- end if
- if not (count(gDownloadPhotos) or count(gDownloadTexts)) then
- exit
- end if
- if the platform contains "16" then
- set pFolderName to char 1 to 8 of the movieName
- else
- set pFolderName to the movieName
- end if
- if offset(".", pFolderName) then
- set pFolderName to char 1 to offset(".", pFolderName) - 1 of pFolderName
- end if
- if the platform contains "Windows" then
- if DirectoryExists(getOSDirectory() & "\DESKTOP") = 0 then
- sendAllSprites(#DownloadMessage, pFolderName)
- else
- set userDeterminesDestination to 1
- CompleteDownLoad(userDeterminesDestination)
- end if
- else
- sendAllSprites(#DownloadMessage, pFolderName)
- end if
- end
-
- on DownloadMessage me, inputFolderName
- set pFolderName to inputFolderName
- case pFunction of
- #CompleteDownLoad, #Cancel:
- sendSprite(the spriteNum of me, #setstate, #norm)
- show(me)
- #blocker, #box:
- show(me)
- #message:
- put "Download Selected Images to your Desktop?" into field the name of the member of sprite the spriteNum of me
- show(me)
- end case
- end
-
- on ClearOutDownload me
- case pFunction of
- #CompleteDownLoad, #Cancel, #box, #message, #blocker:
- hide(me)
- end case
- end
-
- on CompleteDownLoad userDeterminesDestination
- sendAllSprites(#ClearOutDownload)
- updateStage()
- if the platform contains "windows" then
- set CTLF to RETURN & numToChar(10)
- else
- set CTLF to RETURN
- end if
- set downloadPhotoFiles to []
- set photosString to EMPTY
- repeat with photoName in gDownloadPhotos
- append(downloadPhotoFiles, GetPhototFileName(photoName))
- end repeat
- set copyright to CTLF & " © 2000 ™DreamWorks LLC. All rights reserved. Permission granted for reproduction in newspapers and periodicals only. Use of this photography in any manner including but not limited to publication in books, retrospectives, biographies, or in connection with the advertising of posters or any other product or service, permitted only with written permission of the copyright proprietor." & CTLF & CTLF
- set n to 1
- repeat with photoName in gDownloadPhotos
- set photoDescription to GetPhototDescription(photoName)
- put getAt(downloadPhotoFiles, n) && "--" && photoDescription & CTLF & CTLF after photosString
- set n to n + 1
- end repeat
- set indexText to "Small Time Crooks" & CTLF & "Press Kit Photography CD" & CTLF & the time && the date & CTLF
- if the number of chars in photosString then
- put CTLF & CTLF & "You have downloaded the following photo files:" & CTLF & CTLF & photosString & CTLF & CTLF & copyright after indexText
- end if
- if userDeterminesDestination then
- set indexFile to OpenAUserSelectFile()
- updateStage()
- if not objectp(indexFile) then
- exit
- end if
- set folderOfFile to GetFolderOfFileName(fileName(indexFile))
- set folderPath to MakeMovieFolderInLocation(folderOfFile)
- set shortFolderPath to folderPath
- delete char -30000 of shortFolderPath
- put "Files below are located at" && shortFolderPath & CTLF before indexText
- else
- set folderPath to MakeMovieFolderOnDesktop()
- if the platform contains "Windows" then
- set indexFileName to " Index.txt"
- else
- set indexFileName to "Index"
- end if
- set indexFile to openAWriteFile(folderPath & indexFileName)
- end if
- writeString(indexFile, indexText)
- if the platform contains "Mac" then
- setFinderInfo(indexFile, "TEXT ttxt")
- end if
- set Copier to new(xtra("ProgressCopy"), 1, 1, 1)
- repeat with photoFileName in downloadPhotoFiles
- setStrings(Copier, "Downloading", photoFileName, "To Desktop")
- set sourceRoot to the pathName & "Images" & slash()
- set source to sourceRoot & photoFileName
- set dest to folderPath & photoFileName
- CopyFile(Copier, source, dest, 1, 1, 1)
- put errorString(Copier)
- end repeat
- end
-
- on MakeMovieFolderOnDesktop
- if the platform contains "Windows" then
- set newFolderPath to getOSDirectory() & "\DESKTOP\" & pFolderName
- else
- set mainDrive to getAt(DrivesToList(), 1)
- set newFolderPath to mainDrive & ":Desktop Folder:" & pFolderName
- end if
- CreateDirectory(newFolderPath)
- return newFolderPath & slash()
- end
-
- on MakeMovieFolderInLocation location
- set newFolderPath to location & pFolderName
- CreateDirectory(newFolderPath)
- return newFolderPath & slash()
- end
-
- on slash
- if the platform contains "Windows" then
- return "\"
- else
- return ":"
- end if
- end
-
- on openAWriteFile filePathName
- set newFile to new(xtra("fileio"))
- openFile(newFile, filePathName, 2)
- if error(newFile, status(newFile)) = "OK" then
- setPosition(newFile, getLength(newFile))
- return newFile
- else
- createFile(newFile, filePathName)
- openFile(newFile, filePathName, 2)
- return newFile
- end if
- end
-
- on OpenAUserSelectFile
- set newFile to new(xtra("fileio"))
- set fileName to displaySave(newFile, "Save the index as:", "C:\index.txt")
- if fileName = EMPTY then
- return fileName
- end if
- createFile(newFile, fileName)
- if error(newFile, status(newFile)) = "File Already Exits" then
- openFile(newFile, fileName, 0)
- DeleteFile(newFile)
- closeFile(newFile)
- createFile(newFile, fileName)
- end if
- openFile(newFile, fileName, 2)
- return newFile
- end
-
- on GetFolderOfFileName fileName
- set previousItemDelimiter to the itemDelimiter
- set the itemDelimiter to slash()
- set numItems to the number of items in fileName - 1
- set folder to item 1 to numItems of fileName & slash()
- set the itemDelimiter to previousItemDelimiter
- return folder
- end
-
- on getBehaviorDescription me
- set endChar to offset("--END OF HEADER", the text of me)
- set endLine to the number of lines in char 1 to endChar of the text of me - 1
- set description to line 1 to endLine of the text of me
- repeat with whichLine = endLine down to 1
- if line whichLine of description = EMPTY then
- delete line whichLine of description
- end if
- end repeat
- delete line 1 of description
- return description
- end
-